def hello_from_A():
    return 'A'

# module_a.py  
from .B import hello_from_B  
  
def main():  
    print(hello_from_B())  
  
if __name__ == "__main__":  
    main()
    
""" 
python mypackage/A.py
Traceback (most recent call last):
  File "mypackage/A.py", line 5, in <module>
    from .B import hello_from_B  
ImportError: attempted relative import with no known parent package
"""

""" 
python -m mypackage.A
B
"""

""" 
python -m mypackage/A.py
/opt/anaconda3/bin/python: Error while finding module specification for 'mypackage/A.py' (ModuleNotFoundError: No module named 'mypackage/A')
"""